<script setup lang="ts">
//监听

let fns = <any>[];

new Array(20000).fill(null).forEach(e=>{
  function tmp(){}
  fns.push(tmp);
  window.addEventListener('keypress',tmp)
})

// fns.forEach((fn:any):void=>{
//   window.removeEventListener('keypress',fn)
// })
</script>

<template>
  <div>内存泄漏-监听</div>
</template>

<style scoped>

</style>